#include "junix.h"
using namespace std;

struct G
{
	int v;
	G(int n):v(n){}
	int operator()()
	{
		return v++;
	}
};

int main(int argc, char **argv)
{
	vector<int> vi(20);
	generate(vi.begin(),vi.end(),G(0));
	remove_copy_if(vi.begin(),vi.end(),
			ostream_iterator<int>(cout," "),
			 not1(bind2nd(greater_equal<int>(),9)));
	cout<<endl;

	remove_copy_if(vi.begin(),vi.end(),
			ostream_iterator<int>(cout," "),
			bind2nd(equal_to<int>(),9));
	cout<<endl;

	reverse_copy(vi.begin(),vi.end(),
			ostream_iterator<int>(cout," "));
	cout<<endl;
}
